package bankrate;

/**
 * @Author admin
 * @Date 2019/3/19 14:00
 */
public class ConsBank extends Bank{
    double year;
    public ConsBank(){

    }
    public ConsBank(int money,double rate,double year){
        /*
        * 调用父类的构造方法*/
        super(money,rate);
        this.year=year;
    }
    @Override
    public double computerInterest(){
        super.year=(int) year;
        int day=(int)((year-super.year)*1000)+1;

        double yearInter=super.computerInterest();
        double dayInter=day*money*0.0001;
        System.out.println(money+"元存在建设银行，"+super.year+"年"+day+"天，利息是："+(yearInter+dayInter));
        return  yearInter+dayInter;
    }

}
